import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/home',
      name: 'home',
      component: HomeView,
      meta: {
        title: '首页',
      },


      children: [
        {
          path: '/job',
          name: 'job',
          component: () => import('../views/job.vue'),
          meta: {
            title: '工作台',
          },
        },
        {
          path: '/dataall',
          name: 'dataall',
          component: () => import('../views/dataall.vue'),
          meta: {
            title:'数据统计',
          }
        },
        {
          path: '/lsit',
          name: 'list',
          component: () => import('../views/dataall.vue'),
          meta: {
            title:'订单统计',
          }
        },
        {
          path: '/emlp',
          name: 'emlp',
          component: () => import('../views/emlp.vue'),
          meta: {
            title:'订单统计',
          }
        },
        {
          path: '/classify',
          name: 'classify',
          component: () => import('../views/classify.vue'),
          meta: {
            title:'分类管理',
          }
        }

      ]
    },
    {
      path: '/404',
      name: '404',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue'),
    },
    {
      //重定向
      path: '/:pathMatch(.*)*',
      redirect: '/404',
      name: 'Any',
    }, {
      path: '/login',
      name: 'login',
      component: () => import('../views/login.vue'),
      meta: {
        title: '登录',
      },
    },
  ],
})

export default router
